﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;

/// <summary>
/// Summary description for QLTheLoai
/// </summary>
public class QLTheLoai
{
    DBConnection db = new DBConnection();
	public QLTheLoai()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public DataTable Load_TheLoai()
    {
        string sql = "select maloai,tenloai from LoaiHoa";
        return db.Get_data(sql);
    }
    public void Insert_TheLoai(string tentl)
    {
        string sql = "insert into LoaiHoa values(@tentl)";
        SqlParameter p1 = new SqlParameter("@tentl",tentl);
        db.thuchienlenh(sql, p1);
    }
    public void Update_Loai(string maloai,string tenloai)
    {
        string sql = "update LoaiHoa set tenloai=@tenloai where maloai=@maloai";
        SqlParameter p1 = new SqlParameter("@maloai",maloai);
        SqlParameter p2 = new SqlParameter("@tenloai", tenloai);
       db.thuchienlenh(sql, p1, p2);
    }
    public void Delete_Loai(string maloai)
    {
        string sql = "delete from loaihoa where maloai=@maloai";
        SqlParameter p1 = new SqlParameter("@maloai", maloai);
        db.thuchienlenh(sql, p1);
    }
}
